package app;

import java.util.HashMap;

/********************************************************
 *
 *  Project :  TeamProject
 *  Package :  app
 *  File    :  Conversion.java
 *  Name    :  Tyler Daines
 *  Date    :  Nov 3, 2013
 *
 ********************************************************/
public class Conversion
{
	
	private String nullOption = Measurement.NULL.toString();
	private String milliliter = Measurement.MILLILITER.toString();
	private String liter = Measurement.LITER.toString();
	private String milligram = Measurement.MILLIGRAM.toString();
	private String gram = Measurement.GRAM.toString();
	private String kilogram = Measurement.KILOGRAM.toString();
	private String pinch = Measurement.PINCH.toString();
	private String dash = Measurement.DASH.toString();
	private String teaspoon = Measurement.TEASPOON.toString();
	private String tablespoon = Measurement.TABLESPOON.toString();
	private String jigger = Measurement.JIGGER.toString();
	private String cup = Measurement.CUP.toString();
	private String pint = Measurement.PINT.toString();
	private String quart = Measurement.QUART.toString();
	private String gallon = Measurement.GALLON.toString();
	private String ounce = Measurement.OUNCE.toString();
	private String pound = Measurement.POUND.toString();
	private String peck = Measurement.PECKS.toString();
	private String bushel = Measurement.BUSHEL.toString();
	private HashMap<String, Float> conversions;
	
	public Conversion()
	{
		conversions = new HashMap<String, Float>();
		
		conversions.put( nullOption , new Float( 0.00 ));
		conversions.put( milliliter, new Float(1));
		conversions.put( liter, new Float(1000));
		conversions.put( milligram, new Float(.0001));
		conversions.put( gram, new Float(1));
		conversions.put( kilogram, new Float(1000));
		conversions.put( pinch, new Float(.308125));
		conversions.put( dash, new Float(.61625));
		conversions.put( teaspoon, new Float(4.93));
		conversions.put( tablespoon, new Float(14.79));
		conversions.put( jigger, new Float(44.36));
		conversions.put( cup, new Float(236.588));
		conversions.put( pint, new Float(473.18));
		conversions.put( quart, new Float(946.35));
		conversions.put( gallon, new Float(3785.41));
		conversions.put( ounce, new Float(28.3495));
		conversions.put( pound, new Float(453.592));
		conversions.put( peck, new Float(8809.77));
		conversions.put( bushel, new Float(35239.07));
	}
	public Float getAmountByMeasure(Measurement measurement)
	{
		return conversions.get(measurement.toString());
	}
	

}
